package com.wodogs.utils.tools;

import java.io.Serializable;

import com.google.gson.Gson;

public class AppResult implements Serializable{
	
	private static final long serialVersionUID = 1348685002809962162L;
	
	private int status = 1;
	private String msg="";
	private Object data = new Object();
	private Integer hasnext=0;
	
	public AppResult() {
		super();
	}

	public AppResult(int status, String msg, Object data) {
		super();
		this.status = status;
		this.msg = msg;
		this.data = data;
	}
	
	public AppResult(Object data) {
		super();
		this.data = data;
	}

	public static AppResult render200(Object result){
		return new AppResult(result);
	}
	
	public static AppResult render510(){
		return new AppResult(510,null,null);
	}
	
	public static AppResult render500(String msg){
		return new AppResult(500,msg,null);
	}
	
	public int getStatus() {
		return status;
	}
	public void setStatus(int status) {
		this.status = status;
	}
	public String getMsg() {
		return msg;
	}
	public void setMsg(String msg) {
		this.msg = msg;
	}
	
	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}

	@Override
	public String toString(){
		Gson gson = new Gson();
		return gson.toJson(this.data);
//		this.data = JSON.toJSON(this.data);
//		return JSON.toJSONString(this);
	}

	public Integer getHasnext() {
		return hasnext;
	}

	public void setHasnext(Integer hasnext) {
		this.hasnext = hasnext;
	}
	
}
